package tij4.concurrent.source;

import tij4.concurrent.pojo.LiftOff;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class SingleThreadExecutor {

    //如同线程数量为1的FixedThreadPool，用于连续运行任何事物
    //每个任务在下个开始之前结束
    public static void main(String[] args) {
        ExecutorService executorService = Executors.newSingleThreadExecutor();

        for (int i = 0; i < 5; i++) {
            executorService.execute(new LiftOff());
        }
        executorService.shutdown();
    }
}
